﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace orderCreater
{
    public partial class FrmRefresh : Form
    {
        Post_Msg Check_MyVersion(string version)
        {
            string strReturn = tool.post("http://cunwuzhi.22ca.com/admin/index.php?act=paidan_api&op=check_version", "verison=" + version);
            return JsonHelper.DeserializeJsonToObject<Post_Msg>(strReturn);
        }
        public FrmRefresh()
        {
            InitializeComponent();
            Post_Msg p_msg = Check_MyVersion("1");
            if (p_msg.status == 200)
            {
                string jsonText = tool.post(ConfigurationManager.AppSettings["AddressListUrl"], ""); // 获取配送范围
                AddressRang.SendRang = JsonHelper.DeserializeJsonToList<City>(jsonText);
                AddressRang.SendRang.Insert(0, new City());
            }
            else
            {
                button7.Enabled = false;
                button8.Enabled = false;
                button9.Enabled = false;
                button10.Enabled = false;
                MessageBox.Show(p_msg.msg);
            }
        }

        private void button10_Click(object sender, EventArgs e)
        {
            FrmWdhUser myForm = new FrmWdhUser();
            myForm.Show();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            Frm531User myForm = new Frm531User();
            myForm.Show();
        }

        private void button8_Click(object sender, EventArgs e)
        {
            Frm531Login myForm = new Frm531Login();
            myForm.Show();
        }

        private void button9_Click(object sender, EventArgs e)
        {
            Frm531Collect myForm = new Frm531Collect();
            myForm.Show();
        }
    }
}
